//
//  MySingleCollectionViewCell.m
//  MyDIYHouse
//
//  Created by dlios on 15-7-2.
//  Copyright (c) 2015年 李平洋. All rights reserved.
//

#import "MySingleCollectionViewCell.h"

#define HEIGHT [UIScreen mainScreen].bounds.size.height
#define WIDTH [UIScreen mainScreen].bounds.size.width

@implementation MySingleCollectionViewCell

- (void)dealloc {
    [_CommodityImage release];
    [_CommodityNameLabel release];
    [_commentImage release];
    [_commentNamber release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        //商品图片
        self.CommodityImage = [[UIImageView alloc] init];
        //self.CommodityImage.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:self.CommodityImage];
        //商品名
        self.CommodityNameLabel = [[UILabel alloc] init];
        //self.CommodityNameLabel.backgroundColor = [UIColor redColor];
        self.CommodityNameLabel.font = [UIFont systemFontOfSize:18];
        self.CommodityNameLabel.numberOfLines = 0;
        [self.contentView addSubview:self.CommodityNameLabel];
        //评论图片
        self.commentImage = [[UIImageView alloc] init];
        [self.commentImage setImage:[UIImage imageNamed:@"comment_SmallIconGrey"]];
        //self.commentImage.backgroundColor = [UIColor blueColor];
        [self.contentView addSubview:self.commentImage];
        //评论数量
        self.commentNamber = [[UILabel alloc] init];
        //self.commentNamber.backgroundColor = [UIColor greenColor];
        [self.contentView addSubview:self.commentNamber];
    }
    return self;
}


- (void)layoutSubviews {
    [super layoutSubviews];
    self.CommodityImage.frame = CGRectMake(0, 0, (WIDTH - 30) / 2, (HEIGHT - 64 - 49 - 30 - 170) / 2);
    self.CommodityNameLabel.frame = CGRectMake(5, 183, (WIDTH - 50) / 2, 50);
    self.commentImage.frame = CGRectMake(125, 237, 20, 20);
    self.commentNamber.frame = CGRectMake(148, 237, 20, 20);
}


@end
